package com.guslegend.Class01_ioc.test;

import com.guslegend.Class01_ioc.HappyPlay;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author: guslegend
 * @description: setter注入
 * @create: 2025-04-27 09:52
 **/
public class Setter {

    //创建IoC容器,并读取配置文件 注意: 构造函数是可变参数,可以传入一个或者多个配置
    @Test
    public void testSetter(){

        ApplicationContext iocContainer=
                new ClassPathXmlApplicationContext("bean1.xml");

        HappyPlay happyPlay=iocContainer.getBean("happyPlay1", HappyPlay.class);
        System.out.println(happyPlay.getName());
    }
}
